From efc061e453575f1a8d3189e858b8a2d4a39d2310 Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk" Date: Tue, 28 Feb 2006 11:07:18 +0100 Subject: [PATCH] Add 'm' debug key to print free-memory info. Signed-off-by: Keir Fraser --- xen/common/page_alloc.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c index 199818fe65..f594a7fe40 100644 --- a/xen/common/page_alloc.c +++ b/xen/common/page_alloc.c @@ -32,6 +32,7 @@ #include #include #include +#include #include /* @@ -662,6 +663,26 @@ unsigned long avail_domheap_pages(void) } +static void pagealloc_keyhandler(unsigned char key) +{ + printk("Physical memory information:\n"); + printk(" Xen heap: %lukB free\n" + " DMA heap: %lukB free\n" + " Dom heap: %lukB free\n", + avail[MEMZONE_XEN]<<(PAGE_SHIFT-10), + avail[MEMZONE_DMADOM]<<(PAGE_SHIFT-10), + avail[MEMZONE_DOM]<<(PAGE_SHIFT-10)); +} + + +static __init int pagealloc_keyhandler_init(void) +{ + register_keyhandler('m', pagealloc_keyhandler, "memory info"); + return 0; +} +__initcall(pagealloc_keyhandler_init); + + /************************* * PAGE SCRUBBING -- 2.30.2